package controllrs

import (
	"github.com/gin-gonic/gin"
	"jgame-api/lang"
	"net/http"
)

func getMsg(code int) string {
	l := "en"
	switch l {
	case "en":
		return lang.StatusTextEn(code)
	default:
		return ""
	}

}

func resError(c *gin.Context, code int) {
	c.JSON(http.StatusOK, gin.H{
		"code": code,
		"msg":  getMsg(code),
	})
}

func resSuccess(c *gin.Context, data interface{}) {
	c.JSON(http.StatusOK, gin.H{
		"data":  data,
		"error": "",
		"code":  http.StatusOK,
	})
}
